package com.skillworld.webapp.model.util;

public enum RatePoints {

    RATE1(1,0),
    RATE2(2,0),
    RATE3(3,2),
    RATE4(4,2),
    RATE5(5,3);
    
    private final int tutRating;
    private final int points;
    
    private RatePoints(int tutRating,int points){
        this.tutRating = tutRating;
        this.points = points;
    }

    public int getTutRating() {
        return tutRating;
    }

    public int getPoints() {
        return points;
    }
    
    public static int fromRate(int rate){
        return RatePoints.values()[rate -1].points;
    }
    
    public static int teamPointsFromRate(int rate){
        return Math.round(fromRate(rate)/2 + fromRate(rate)%2);
    }
}
